package org.openems.entity;

public class BooleanEntity extends AbstractEntity {
	@Override
	public boolean equals(Object obj) {
		BooleanEntity e = (BooleanEntity)obj;
		return this.value.equals(e.value) && this.getName().equals(e.getName());
	}

	public Boolean getValue() {
		return value;
	}

	public void setValue(Boolean value) {
		this.value = value;
	}

	private Boolean value = false;
	/**
	 * 
	 */
	private static final long serialVersionUID = -2305271837797502402L;

	@Override
	protected BooleanEntity clone() {
		try {
			return (BooleanEntity)super.clone();
		} catch (CloneNotSupportedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	public BooleanEntity(Key key, String name, boolean persisted) {
		super(key, name, persisted);
		// TODO Auto-generated constructor stub
	}

	@Override
	public Entity getClone() {
		return this.clone();
	}

	@Override
	public String getValueText() {
		return this.value.toString();
	}

	@Override
	public void setValueText(String text) throws InvalidValueException {
		this.value = Boolean.valueOf(text);
	}

}
